<?php
if (($_POST[auth_key] == 'f5g6h7j8k9l0') && ($_POST[title] != NULL) && ($_POST[text] != NULL) && ($_POST[tags] != NULL)) {
	mysql_connect("localhost", "root", "");
	mysql_select_db("blog_utf");
	mysql_query("SET NAMES 'utf8'");  
	mysql_query("SET CHARACTER SET 'utf8'");
	mysql_query("INSERT INTO texts (title,date,text,mark) VALUES('$_POST[title]', NOW(), '$_POST[text]', '$_POST[tags]')");
	foreach (glob("../cache/data*.html") as $file_delete_name) {
		unlink($file_delete_name);
	}
	$_GET[tag]='all';
	include('../engine/load_data.php');
} else {
	include('../templates/add.html');
	/*
	print $_POST[auth_key];
	print $_POST[title];
	print $_POST[text];
	print $_POST[tags];
	*/
}
?> 
	
	